package com.example.class_manage.Mapper;

import com.example.class_manage.Entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface Usermapper {
    @Select("select * from user where flag=2 and sclass = #{sclass} and grade = #{grade}")
    List<User> queryUserlist(String sclass, String grade);

    @Insert("insert into user (id,name,sclass,grade,iszhujiao,flag) values (#{id},#{name},#{sclass},#{grade},#{iszhujiao},#{flag})")
    int addUser(User u1);

    @Update("update user set iszhujiao = #{iszhujiao} where id = #{id}")
    int updateUser(int id, int iszhujiao);

    @Delete("delete from user where id = #{id}")
    int deleteUser(String id);

    @Update("update user set sclass = #{sclass} where id = #{id} and flag = 2")
    int updatesclass(int id, String sclass);

    @Update("update user set grade = #{grade} where id = #{id} and flag =2")
    int updatesgrade(int id, int grade);

    @Update("update user set name = #{name} where id = #{id} and flag = 2")
    int updatename(int id, String name);

    @Update("update user set name = #{name} where id = #{id} and flag = 1")
    int updatetname(int id, String name);

    @Update("update user set grade = #{grade} where id = #{id} and flag = 1")
    int updategrade(int id, int grade);

    @Update("update user set sclass = #{sclass} where id = #{id} and flag = 1")
    int updatetgrade(int id, int sclass);

    @Select("select * from user where id = #{id}")
    User queryUser(int id);


}
